package com.zhuchaooasystem.presenter.home.fragment;

import android.app.Activity;

import com.hwangjr.rxbus.RxBus;
import com.umeng.analytics.MobclickAgent;
import com.zhuchaooasystem.R;
import com.zhuchaooasystem.base.BaseEvent;
import com.zhuchaooasystem.base.BasePresenter;
import com.zhuchaooasystem.event.OAToServiceEvent;
import com.zhuchaooasystem.ui.home.fragment.oa.daily.DailyActivity;
import com.zhuchaooasystem.ui.home.fragment.oa.record.RecordActivity;
import com.zhuchaooasystem.ui.home.fragment.oa.sign.SignActivity;
import com.zhuchaooasystem.utils.AppUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author yinsi
 */


public class OAPresenter extends BasePresenter<OAContract.View> implements OAContract.Presenter {

    public OAPresenter(Activity activity, OAContract.View view) {
        super(activity, view);
    }

    /**
     * 初始化菜单信息
     */
    public List<Map<String, Object>> initMenus() {
        List<Map<String, Object>> listMap = new ArrayList<>();
        Map<String, Object> map = new HashMap<>();
        map.put("icon", R.drawable.ic_oa_sign);
        map.put("name", "打卡");
        listMap.add(map);
        Map<String, Object> map1 = new HashMap<>();
        map1.put("icon", R.drawable.ic_oa_daily);
        map1.put("name", "我的日报");
        listMap.add(map1);
        Map<String, Object> map2 = new HashMap<>();
        map2.put("icon", R.drawable.ic_oa_record);
        map2.put("name", "录音采集");
        listMap.add(map2);
        Map<String, Object> map3 = new HashMap<>();
        map3.put("icon", R.drawable.ic_oa_new);
        map3.put("name", "新建服务");
        listMap.add(map3);
        Map<String, Object> map4 = new HashMap<>();
        map4.put("icon", R.drawable.ic_oa_start);
        map4.put("name", "开始服务");
        listMap.add(map4);
        Map<String, Object> map5 = new HashMap<>();
        map5.put("icon", R.drawable.ic_oa_finish);
        map5.put("name", "完成服务");
        listMap.add(map5);
        return listMap;
    }

    /**
     * 点击表格跳转
     */
    public void jump(int position) {
        switch (position) {
            //打卡
            case 0:
                MobclickAgent.onEvent(mActivity, "countSignClick");
                AppUtils.jump(mActivity, SignActivity.class);
                break;
            //日报
            case 1:
                MobclickAgent.onEvent(mActivity, "countDailyClick");
                AppUtils.jump(mActivity, DailyActivity.class);
                break;
            //录音
            case 2:
                MobclickAgent.onEvent(mActivity, "countRecordClick");
                AppUtils.jump(mActivity, RecordActivity.class);
                break;
            //新建
            case 3:
                RxBus.get().post("turnToService", new BaseEvent<OAToServiceEvent>(new OAToServiceEvent(0, "新建服务")));
                break;
            //开始
            case 4:
                RxBus.get().post("turnToService", new BaseEvent<OAToServiceEvent>(new OAToServiceEvent(1, "开始服务")));
                break;
            //完成
            case 5:
                RxBus.get().post("turnToService", new BaseEvent<OAToServiceEvent>(new OAToServiceEvent(2, "完成服务")));
                break;
        }
    }

}
